Repository navigation
zero-swift: list a group's running clients in activeClients - #11
Merged
Merged
Conversation
Two Zero instances in one client group, in one process, list each other in initConnection's activeClients, and the survivor sends deleteClients for one that closes, as JS's ActiveClientsManager does. Amp-Thread-ID: https://ampcode.com/threads/T-c513a037-a257-45e0-b9a9-15c15edfe859 Co-authored-by: tmm <tmm@tmm.dev>
tmm
force-pushed
the
swift-active-clients
branch
from
October 22, 2026 03:58
0d2fa09 to
99a9c9c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a bug found by the bug sweep: two
Zeroinstances in one client group, in one process (same user, storageKey and storage, e.g. two windows), broke each other on the server.initConnectionsentactiveClientswith only the connecting client, so zero-cache deleted the other running client of the group along with its queries. A closed client was also never reported withdeleteClients.ReplicaDatabasetracks the running clients of the process (JS'sActiveClientsManager, without the Web Locks, since Swift coordinates within one process).activeClientslists the group's running clients, this one first, and when one closes, each other client of the group sendsdeleteClientsfor it once, if connected, as JS does.onDeleteonly sends the message.Checked: the two sweep tests failed before and pass now. 161 Swift tests and the lint pass. A new E2E test,
twoClientsOfAGroupBothKeepTheirQueries, fails on the old code (withttl: .none) and passes against a real zero-cache.